package com.xinda.admin.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.xinda.admin.dao.StyleMapper;
import com.xinda.admin.pojo.ProductStyle;

@Component("styleService")
public class StyleServiceImpl implements IStyleService {

	@Autowired
	StyleMapper styleMapper;
	
	public void updateStatusById(int id, int status) {
		ProductStyle style = new ProductStyle();
		style.setId(id);
		style.setStatus(status);
		
		styleMapper.updateStyle(style);
	}

	public List<ProductStyle> queryStyleList() {
		ProductStyle style = new ProductStyle();
		return styleMapper.seleteStyle(style);
	}

	public ProductStyle queryStyleById(int id) {
		ProductStyle style = new ProductStyle();
		style.setId(id);
		return styleMapper.seleteStyle(style).get(0);
	}

	public void deleteStyleById(int id) {
		ProductStyle style = new ProductStyle();
		style.setId(id);
		styleMapper.deleteStyle(style);
	}

	public void updateStyle(ProductStyle style) {
		styleMapper.updateStyle(style);
	}

	public void addStyle(ProductStyle style) {
		styleMapper.addStyle(style);
	}

}
